package routers

import (
	"bubble/controller"
	"github.com/gin-gonic/gin"
)

func SetupRouter() *gin.Engine  {
	r := gin.Default()
	//设置静态文件和模版引擎
	//r.Static("/static", "static")
	//告诉gin框架去哪里找模板文件
	//r.LoadHTMLGlob("templates/*")
	//简单学习而已
	//r.GET("/", controller.IndexHandler)
	//设置api
	v1Group := r.Group("v1")
	{
		//crud
		//待办事项
		//添加
		v1Group.POST("/todo", controller.CreateTodo)
		//查看所有的待办事项
		v1Group.GET("/todo", controller.GetTodoList)
		//修改
		v1Group.PUT("/todo/:id", controller.UpdateTodo)
		//删除
		v1Group.DELETE("/todo/:id", controller.DeleteATodo)
	}
	return  r

}
